package edu.whu.demo.dao;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import edu.whu.demo.domain.User;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author 
 * @since 2022-11-24
 */
@Mapper
public interface UserDao extends BaseMapper<User> {
    @Select("select p.* from user p ${ew.customSqlSegment}")
    IPage<User> findAccount(IPage<User> page, @Param(Constants.WRAPPER) QueryWrapper<User> wrapper);

    @Select("select name from user where uid=#{uid}")
    String findNameByUid(Long uid);

    @Select("select * from user where name=#{name}")
    User findByName(String name);
}
